﻿///SinLine.as 该类为正弦曲线的创建y=a*sin(bx);
//vesion 1.0
//author 夏天的树人
package org.summerTree.graphics
{
	import flash.geom.Point;
	public class SinLine extends Base 
	{
		private var START_POINT:Point;
		public function SinLine()
		{

		}
		override public function clone():*
		{
			return new SinLine();
		}
		//创建正弦曲线图案
		//y=a*sin(b*x);
		public function CreatSinLine(swing:Number,wavelengh:Number,X_length:Number,amount:int,startX:Number=0,startY:Number=0):void
		{
			this.graphics.lineStyle(1,color);
			this.graphics.moveTo(startX,startY);
			var W_len:int=int(360/wavelengh);//波长180度

            if(amount<=0)return;
				for (var i:int=0; i<=W_len*amount; i++)
				{
					var posX:Number=i*X_length/W_len;
					var posY:Number=swing*Math.sin(-i*wavelengh*Math.PI/180);
					this.graphics.lineTo(posX,posY);
				}
			
		}
		//public function clear():void
//		{
//			this.graphics.clear();
//		}
	}
}